package com.shenghua;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * Created by Administrator on 2019/5/24.
 */
@Component
@Order(2) // 数值越小，优先级越高
public class MyApplicationRunner implements ApplicationRunner {
    private Logger logger = LoggerFactory.getLogger(MyApplicationRunner.class);
    @Override
    public void run(ApplicationArguments applicationArguments) throws Exception {
        logger.info(">>>>>>>>>>MyApplicationRunner 服务启动执行！<<<<<<<<<");
        if (applicationArguments != null) {
            String[] argArr = applicationArguments.getSourceArgs();
            for (String s : argArr) {
                logger.info("MyApplicationRunner:" + s);
            }
        }
    }
}
